home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / source / music4c.sit / Music4C Folder / Sources Folder / ErrorAlert.c < prev    next >
Text File  |  1990-06-08  |  2KB  |  68 lines

  1. /*
  2. * ⌐ Graeme Gerrard 1990
  3. * Faculty of Music, University of Melbourne
  4. * Parkville Victoria 3052 Australia.
  5. *
  6. * ARPANET: grae@murdu.ucs.unimelb.edu.au
  7. * telephone: (613) 344 4127, Fax: (613) 344 5346
  8. */
  9.  
  10. #include "Music4C.h"
  11.  
  12. void    OSError(Str1, Str2, theErr)
  13.     Str255    Str1, Str2;
  14.     OSErr    theErr;
  15. {
  16.     
  17.     Str255    Str3;
  18.     
  19.     if (theErr)
  20.         NumToString(theErr, &Str3);
  21.     ParamText(Str1, Str2, Str3, NIL);
  22.     A_ErrorAlert();
  23. }
  24.  
  25.  
  26.  
  27. void  A_ErrorAlert()
  28. {
  29.  
  30. #define  I_OK  1
  31. #define  I_x  2
  32. #define  I_x3  3
  33. #define  I_x5  4
  34.     short   itemHit;
  35.     AlertTHndl   AlertResHandle;
  36.     Rect   tempRect;
  37.  
  38.  
  39.     InitCursor();
  40.     AlertResHandle = (AlertTHndl)GetResource('ALRT', ABOUT_DIALOG);
  41.     HLock((Handle)AlertResHandle);
  42.     tempRect.left = (*AlertResHandle)->boundsRect.left;
  43.     tempRect.right = (*AlertResHandle)->boundsRect.right;
  44.     tempRect.top = (*AlertResHandle)->boundsRect.top;
  45.     tempRect.bottom = (*AlertResHandle)->boundsRect.bottom;
  46.     tempRect.top = ((screenBits.bounds.bottom - screenBits.bounds.top) - (tempRect.bottom - tempRect.top)) / 3;
  47.     tempRect.left = ((screenBits.bounds.right - screenBits.bounds.left) - (tempRect.right - tempRect.left)) / 2;
  48.     tempRect.bottom = tempRect.top + ((*AlertResHandle)->boundsRect.bottom - (*AlertResHandle)->boundsRect.top);
  49.     tempRect.right = tempRect.left + ((*AlertResHandle)->boundsRect.right - (*AlertResHandle)->boundsRect.left);
  50.     (*AlertResHandle)->boundsRect.left = tempRect.left;
  51.     (*AlertResHandle)->boundsRect.right = tempRect.right;
  52.     (*AlertResHandle)->boundsRect.top = tempRect.top;
  53.     (*AlertResHandle)->boundsRect.bottom = tempRect.bottom;
  54.      
  55.     /* Let the OS handle the Alert and wait for a result to be returned */
  56.     itemHit = NoteAlert(4, NIL);
  57.     HUnlock((Handle)AlertResHandle);
  58.      
  59.     /* This is a button that may have been pressed. */
  60.     if (I_OK == itemHit)
  61.     {
  62.         /* ?? PLACE YOUR CODE HERE */
  63.     }
  64.     ExitToShell();    /* we only get here if we got a severe error */
  65. }
  66.  
  67.  
  68.